<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是OTA功能功能的分析与体验的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV01-01-AliOSThings-08-OTA">
<meta property="og:url" content="https://sumumm.github.io/post/eb6d74df.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是OTA功能功能的分析与体验的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/1700176851078-1.jpg">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20200708165718169.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231117073546487.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118092758542.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20200708164623382.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118094737636.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118094913582.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118095051408.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101103395.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101400689.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101551086.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101855192.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118102348347.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118102755088.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118102855521.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20200630165512276.png">
<meta property="article:published_time" content="2023-11-26T13:33:03.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.020Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="LV21-天猫精灵IOT">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/1700176851078-1.jpg">


<link rel="canonical" href="https://sumumm.github.io/post/eb6d74df.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/eb6d74df.html","path":"post/eb6d74df.html","title":"LV01-01-AliOSThings-08-OTA"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV01-01-AliOSThings-08-OTA | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81OTA%E7%AE%80%E4%BB%8B"><span class="nav-text">一、OTA简介</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81mk3080-OTA%E5%8E%9F%E7%90%86"><span class="nav-text">二、mk3080-OTA原理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-mk3080-flash%E5%88%86%E5%8C%BA"><span class="nav-text">1. mk3080 flash分区</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E9%93%BE%E6%8E%A5%E8%84%9A%E6%9C%AC"><span class="nav-text">2. 链接脚本</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81esp8266-OTA%E5%8E%9F%E7%90%86"><span class="nav-text">三、esp8266-OTA原理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-esp8266-flash%E5%88%86%E5%8C%BA"><span class="nav-text">1. esp8266 flash分区</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E9%93%BE%E6%8E%A5%E8%84%9A%E6%9C%AC-1"><span class="nav-text">2. 链接脚本</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E5%9C%A8mk3080%E4%B8%8A%E4%BD%93%E9%AA%8COTA"><span class="nav-text">四、在mk3080上体验OTA</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E4%BF%AE%E6%94%B9%E5%B7%A5%E7%A8%8B%E6%BA%90%E7%A0%81"><span class="nav-text">1. 修改工程源码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E7%83%A7%E5%BD%95%E5%B7%A5%E5%85%B7%E4%B8%8E%E7%A1%AC%E4%BB%B6%E9%85%8D%E7%BD%AE"><span class="nav-text">2. 烧录工具与硬件配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-Ymodem%E5%8D%8F%E8%AE%AE%E7%83%A7%E5%86%99OTA%E7%A8%8B%E5%BA%8F"><span class="nav-text">3. Ymodem协议烧写OTA程序</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/eb6d74df.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV01-01-AliOSThings-08-OTA | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV01-01-AliOSThings-08-OTA
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-11-26 21:33:03" itemprop="dateCreated datePublished" datetime="2023-11-26T21:33:03+08:00">2023-11-26</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/" itemprop="url" rel="index"><span itemprop="name">01HQ课程体系</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/" itemprop="url" rel="index"><span itemprop="name">LV21-天猫精灵IOT</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>5.8k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>21 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是OTA功能功能的分析与体验的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>Windows版本</td>        <td align="left">windows11</td>    </tr>    <tr>        <td align="center">Ubuntu版本</td>        <td align="left">Ubuntu22.04的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 16 Pro</td>        <td align="left">16.2.3 build-19376536</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="6">官方网站</td>        <td align="left"><a href="https://cn.aliyun.com/" target="_blank">阿里云</a></td>        <td align="left">阿里云官网主页</td>    </tr>    <tr>        <td align="left"><a href="https://www.aliyun.com/product/iot/livinglink?spm=5176.28508143.J_4VYgf18xNlTAyFFbOuOQe.317.5421154acZniIL&scm=20140722.X_data-1da961ea118f5bb0e4b2._.V_1" target="_blank">阿里生活物联平台</a></td>        <td align="left">生活物联网平台(飞燕平台)主页</td>    </tr>    <tr>        <td align="left"><a href="https://iap.aligenie.com/?spm=0.7629140.0.0.2c611780Ty6tzg" target="_blank">AliGenie</a></td>        <td align="left">天猫精灵开放平台AliGenie主页</td>    </tr>    <tr>        <td align="left"><a href="https://www.aliyun.com/product/iot/iot_instc_public_cn?spm=5176.28508143.J_4VYgf18xNlTAyFFbOuOQe.81.5421154au3ocqp&scm=20140722.X_data-9349178ba84cf028806a._.V_1" target="_blank">阿里物联网平台</a></td>        <td align="left">阿里物联网平台主页</td>    </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/" target="_blank">Bluetooth 技术网站</a></td>        <td align="left">蓝牙协议规范什么的可以来这里找</td>    </tr>    <tr>        <td align="left"><a href="https://www.telink-semi.com/" target="_blank">Telink</a></td>        <td align="left">Telink | Chips for a Smarter IoT (telink-semi.com)<br><a href="https://www.telink-semi.cn/" target="_blank">Telink中文官网</a></td>    </tr>    <tr>        <td align="center" rowspan="5">开发手册</td>        <td align="left"><a href="https://help.aliyun.com/zh/alios-things/" target="_blank">AliOS Things开发指南</a></td>        <td align="left">AliOS Things开发指南，这里是最新版本，可以直接从官网找到</td>    </tr>     <tr>        <td align="left"><a href="https://haas.iot.aliyun.com/aliosthings/index.html" target="_blank">AliOS Things开发指南</a></td>        <td align="left">AliOS Things应用开发指南，这里应该是3.3版本的完整开发文档</td>    </tr>    <tr>        <td align="left"><a href="https://gaic.alicdn.com/aic/h5_daily/test/aliosthings/3.0.13/index.html" target="_blank">AliOS Things开发指南(3.0)</a></td>        <td align="left">AliOS Things应用开发指南，这里应该是3.0版本的完整开发文档</td>    </tr>    <tr>        <td align="left"><a href="https://help.aliyun.com/product/123207.html?spm=a2c4g.11186623.6.540.114e60d84sF58G" target="_blank">生活物联网平台开发文档</a></td>        <td align="left">生活物联网平台（飞燕平台）开发文档<br><a href="https://help.aliyun.com/document_detail/180778.html?spm=a2c4g.123207.0.0.49556adcO5apvd" target="_blank">《设备端开发指南》</a></td>    </tr>    <tr>        <td align="left"><a href="https://doc-bot.tmall.com/docs/doc.htm?spm=0.7629140.0.0.7bf81780UN7WkQ&treeId=578&articleId=118057&docType=1" target="_blank">Wi-Fi IoT品类定义与功能开发</a></td>        <td align="left">天猫精灵IoT开放平台——Wi-Fi IoT品类定义与功能开发</td>    </tr>    <tr>        <td align="center" rowspan="3">硬件平台</td>        <td align="left"><a href="https://developer.aliyun.com/article/761644?spm=a2c6h.12873581.0.dArticle761644.1c1b589dRHgvcR&groupCode=genieaiot" target="_blank">mk3080 WiFi开发板</a></td>        <td align="left">WiFi开发板使用指南-阿里云开发者社区</td>    </tr>    <tr>        <td align="left"><a href="http://www.taichi-maker.com/homepage/esp8266-nodemcu-iot/esp8266-nodemcu-tutorial-index/" target="_blank">esp8266开发板</a></td>        <td align="left">一个教程：ESP8266-NodeMCU开发板详解-太极创客 (taichi-maker.com)</td>    </tr>    <tr>        <td align="left"><a href="https://wiki.telink-semi.cn/doc/ds/DS_TLSR8258-E_Datasheet%20for%20Telink%20BLE+IEEE802.15.4%20Multi-Standard%20Wireless%20SoC%20TLSR8258.pdf" target="_blank">TLSR8258 Datasheet</a></td>        <td align="left">Datasheet for Telink BLE + IEEE802.15.4 MultiStandard Wireless SoC TLSR8258</td>    </tr>    <tr>        <td align="center" rowspan="2">参考资料</td>        <td align="left"><a href="https://developer.aliyun.com/article/720516#" target="_blank">AliOS Things 3.0 应用开发指南</a></td>        <td align="left">这个只是一篇参考文章，里面是一些环境搭建相关的，可以参考</td>    </tr>    <tr>        <td align="left"><a href="https://info.support.huawei.com/info-finder/encyclopedia/zh/index.html" target="_blank">IP知识百科 - 华为 (huawei.com)</a></td>        <td align="left">IP的一些相关知识点</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="left" rowspan="6">蓝牙规范相关文档</td>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/specs/core-specification-5-2/" target="_blank">Core Specification 5.2</a></td>        <td align="left">核心规格 5.2，该规范定义了创建可互操作的Bluetooth 设备所需的技术。                        <br><a href="./蓝牙参考资料/Core_v5.2.pdf" target="_blank">《Core_v5.2.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/specs/mesh-model-1-1/" target="_blank">Mesh Model(v1.1)</a></td>        <td align="left">本Bluetooth 规范定义了模型（以及它们所需的状态和消息），这些模型用于在mesh 网络中的节点上执行基本功能，超出了Bluetooth Mesh 配置文件 规范中定义的基础模型。                        <br>本规范包括定义跨设备类型标准功能的通用模型，以及支持关键mesh 场景的模型，如照明控制、传感器、时间和场景。                        <br><a href="./蓝牙参考资料/MshMDL_v1.1.pdf" target="_blank">《MshMDL_v1.1.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/specs/mesh-profile-1-0-1/" target="_blank">Mesh Profile(v1.0.1)</a></td>        <td align="left">该Bluetooth 规范定义了基本要求，以实现可互操作的mesh 网络解决方案，用于Bluetooth 低能量无线技术。                        <br><a href="./蓝牙参考资料/MshPRFv1.0.1.pdf" target="_blank">《MshPRFv1.0.1.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/zh-cn/specifications/device-properties/" target="_blank">Mesh Device Properties</a></td>        <td align="left">本规范包含Bluetooth Mesh 配置文件 和Bluetooth Mesh 模型规范所要求的设备属性的定义。                        <br>但是跟之前的有些区别，我主要看的之前的版本：<a href="./蓝牙参考资料/MeshDeviceProperties_v1.2.pdf" target="_blank">《MMeshDeviceProperties_v1.2.pdf》</a></td>      </tr>    <tr>        <td align="left"><a href="https://www.bluetooth.com/specifications/gss/" target="_blank">GATT Specification Supplement</a></td>        <td align="left">GATT Specification Supplement | Bluetooth® Technology Website。                        <br>好像可以在线看：<a href="https://btprodspecificationrefs.blob.core.windows.net/gatt-specification-supplement/GATT_Specification_Supplement.pdf" target="_blank">《GATT Specification Supplement》</a></td>      </tr>     <tr>        <td align="left"><a href="https://www.bluetooth.com/specifications/assigned-numbers/" target="_blank">Assigned Numbers</a></td>        <td align="left">GATT的一些类型定义可以在这里找。</td>      </tr>    <tr>        <td align="left" rowspan="2">AliOS Things</td>        <td align="left"><a href="https://gitee.com/alios-things-admin/AliOS-Things" target="_blank">alios-things/AliOS-Things</a></td>        <td align="left">Gitee上的AliOSThings SDK源码仓库</td>      </tr>    <tr>        <td align="left"><a href="https://github.com/alibaba/AliOS-Things" target="_blank">alibaba/AliOS-Things</a></td>        <td align="left">GitHub上的AliOSThings SDK源码仓库</td>      </tr>    <tr>        <td align="left" rowspan="2">天猫精灵蓝牙Mesh协议栈</td>        <td align="left"><a href="https://github.com/alibaba-archive/genie-bt-mesh-stack" target="_blank">alibaba-archive/genie-bt-mesh-stack</a></td>        <td align="left">GitHub上的天猫精灵蓝牙Mesh协议栈源码仓库。<br>之前是在<a href="https://github.com/alibaba/genie-bt-mesh-stack"target="_blank">alibaba/genie-bt-mesh-stack</a>这个仓库。<br>写笔记的时候最新提交为<a href="https://github.com/alibaba-archive/genie-bt-mesh-stack/tree/faf523618a6a2560090fc423222b9db80984bb7a" target="_blank">faf523618a6a2560090fc423222b9db80984bb7a</a></td>      </tr>    <tr>        <td align="left"><a href="https://help.aliyun.com/document_detail/171552.html?spm=a2c4g.173310.0.0.55d6e992e8xJip" target="_blank">蓝牙Mesh设备开发指南</a></td>        <td align="left">阿里云生活服务平台开发手册——蓝牙设备开发一节中的内容</td>      </tr></table>
              </div>
            </details>

<h1 id="一、OTA简介"><a href="#一、OTA简介" class="headerlink" title="一、OTA简介"></a><font size=3>一、OTA简介</font></h1><p>OTA（Over-The-Air）移动终端的空中下载软件升级，指通过云端升级技术，为具有连网功能的设备：例如手机、平板电脑、便携式媒体播放器、移动互联网设备等提供固件升级服务，用户使用网络以按需、易扩展的方式获取智能终端系统升级包，并通过FOTA进行云端升级，完成系统修复和优化。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/1700176851078-1.jpg" alt="timg (1)" style="zoom: 67%;" />

<h1 id="二、mk3080-OTA原理"><a href="#二、mk3080-OTA原理" class="headerlink" title="二、mk3080-OTA原理"></a><font size=3>二、mk3080-OTA原理</font></h1><h2 id="1-mk3080-flash分区"><a href="#1-mk3080-flash分区" class="headerlink" title="1. mk3080 flash分区"></a><font size=3>1. mk3080 flash分区</font></h2><p>我们来看一下mk3080的flash分区情况：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20200708165718169.png" alt="image-20200708165718169" style="zoom:50%;" />

<blockquote>
<p>为什么会有这么多的分区？</p>
</blockquote>
<p>对于mk3080来说，上面的那些bin文件都是存在于硬件的外部flash中。mk3080使用的芯片是rtl8710bn，芯片厂商在芯片出厂的时候，厂商已经在芯片上固化了一部分的程序，这部分程序包括厂商自己的bootloader（据我的理解，应该是做芯片启动和程序烧录的那部分代码，因为厂商不可能做一款芯片，不给下载程序的功能吧）和厂商自己的一些system程序（具体的不清楚，没有了解过，只知道与厂商的系统相关）。</p>
<p>然后AliOS-Things在厂商给的这个芯片上做二次开发，AliOS-Things想要做OTA功能，实现在线升级程序，厂商自己的bootloader又是不开源的，没法修改，那怎么办？只能在上层自己再实现一个自己的带有OTA功能的bootloader喽。这就是之前我们编译出来的文件中有一个image2_2ndboot.bin的原因啦。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231117073546487.png" alt="image-20231117073546487" style="zoom:50%;" />

<p>所以现在的基本的运行情况是怎样的？首先，芯片上电，开始运行厂商自己的boot_all.bin，然后运行system.bin的部分，再跳转到image2_2ndboot.bin运行，最后是image2app（while循环中不断打印helloworld）程序的运行。最后的image2App_ota其实就是OTA升级的新的功能应用程序，那么怎么进入这个ota的应用程序？正常就是直接运行自己的image2app，所以这个时候就需要image2_2ndboot.bin啦，当我们接收完oat应用程序后，把它存放在image2App_ota这个区域，然后会有一个标志位，重启设备的时候2ndboot就会根据这个标志直接跳转image2App_ota执行。（总觉得怪怪的，按照我自己的理解，这里应该是开机进入2ndboot，这个2ndboot实现ota程序的接收和写入功能，直接将ota升级的程序写入到原来的应用程序处，因为升级ota程序后，下次重启，程序直接是ota程序了，而不再是原来的程序，所以我不是很理解课程中老师为什么多加了个image2App_ota，后面确定了再更新这里吧）。</p>
<blockquote>
<p>怎么知道是这样分区的？</p>
</blockquote>
<p>主要是从一个makefile配置文件中分析得到的，我们可以看一下AliOS-Things源码目录中的 platform&#x2F;mcu&#x2F;rtl8710bn&#x2F;gen_inage_bin.mk 这个文件：</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 上面部分省略......</span></span><br><span class="line"><span class="comment">#bootloader</span></span><br><span class="line">BOOT_BIN_FILE    := <span class="variable">$(OUTPUT_DIR)</span>/binary/boot_all.bin <span class="comment">## 指定了boot_all.bin输出路径</span></span><br><span class="line">BOOT_OFFSET      := 0x0 <span class="comment">## 偏移地址 基于flash基地址 偏移多少</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#application</span></span><br><span class="line">SYSTEM_BIN_FILE := <span class="variable">$(SYSTEMBIN_DIR)</span>/system.bin <span class="comment">## system.bin输出路径</span></span><br><span class="line">SYSTEM_OFFSET:= 0x9000 <span class="comment">## 偏移地址 基于flash基地址 偏移0x9000</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#2ndboot</span></span><br><span class="line">2NDBOOT_BIN_FILE :=<span class="variable">$(OUTPUT_DIR)</span>/binary/image2_2ndboot.bin <span class="comment">## 2ndboot.bin输出路径</span></span><br><span class="line"><span class="section">2NDBOOT_OFFSET:= 0xB000 ## 偏移地址 基于flash基地址 偏移0xB000</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#ate firmware</span></span><br><span class="line">ATE_BIN_FILE := <span class="variable">$(AMEBAZ_DIR)</span>/ate.bin <span class="comment">#ate firmware  这个是厂商的 是基于AT执行的代码</span></span><br><span class="line">ATE_OFFSET:= 0xD0000</span><br><span class="line"></span><br><span class="line"><span class="comment">#app</span></span><br><span class="line">APP_BIN_FILE := <span class="variable">$(OUTPUT_DIR)</span>/binary/image2_app.bin <span class="comment">## image2_app.bin输出路径 helloworld 实现的.bin文件</span></span><br><span class="line">APP_OFFSET := 0x19000 <span class="comment">## 偏移地址 基于flash基地址 偏移0x19000</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 下面部分省略......</span></span><br></pre></td></tr></table></figure>

<h2 id="2-链接脚本"><a href="#2-链接脚本" class="headerlink" title="2. 链接脚本"></a><font size=3>2. 链接脚本</font></h2><p>在最后一步进行程序链接的时候会用到链接脚本，mk3080的相关链接脚本是什么？其实这个可以从编译打印信息中看出，但是默认的打印信息</p>
<p>都是简化了的，写这篇笔记的时候还没有详细去研究，那我们直接找吧。这个链接脚本在两个地方有：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">1. mk3080的工程目录</span></span><br><span class="line">helloworld_mk3080/board/mk3080/ld</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">2. AliOS-Things源码目录</span></span><br><span class="line">AliOS-Things-SDK/platform/board/mk3080/ld/</span><br></pre></td></tr></table></figure>

<p>它们都有以下四个文件：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">hk@vm:~/6AliOS/helloworld_mk3080/board/mk3080/ld$ tree</span><br><span class="line">.</span><br><span class="line">├── rlx8711B-symbol-v02-img2-2ndboot.ld # aos 二次引导程序的链接脚本</span><br><span class="line">├── rlx8711B-symbol-v02-img2.ld         # 厂商bin文件的链接脚本</span><br><span class="line">├── rlx8711B-symbol-v02-img2_xip1.ld    # aos app链接脚本</span><br><span class="line">└── rlx8711B-symbol-v02-img2_xip2.ld    # aos app_ota的链接脚本</span><br><span class="line"></span><br><span class="line">0 directories, 4 files</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118092758542.png" alt="image-20231118092758542" style="zoom:50%;" />



<p>后面两个ld链接脚本就是我们的应用程序所用到的链接脚本，xip是表示程序放在外部flash。我们来看一下rlx8711B-symbol-v02-img2_xip1.ld中都有什么：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">ENTRY(Reset_Handler)</span><br><span class="line"></span><br><span class="line">INCLUDE &quot;script/export-rom_symbol_v01.txt&quot;</span><br><span class="line"></span><br><span class="line">GROUP (</span><br><span class="line">  libgcc.a</span><br><span class="line">  libc.a</span><br><span class="line">  libg.a</span><br><span class="line">  libm.a</span><br><span class="line">  libnosys.a</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line">MEMORY</span><br><span class="line">&#123;</span><br><span class="line">        ROM (rx) :                      ORIGIN = 0x00000000, LENGTH = 0x80000   /* ROM: 512k */</span><br><span class="line">        ROMBSS_RAM (rw)  :              ORIGIN = 0x10000000, LENGTH = 0x2000    /* ROM BSS RAM: 8K */</span><br><span class="line">        BOOTLOADER_RAM (rwx)  :         ORIGIN = 0x10002000, LENGTH = 0x3000    /* BOOT Loader RAM: 12K */</span><br><span class="line">        BD_RAM (rwx)  :                 ORIGIN = 0x10005000, LENGTH = 0x38000   /* MAIN RAM: 228 */</span><br><span class="line">        ROM_BSS_RAM (rwx)  :            ORIGIN = 0x1003D000, LENGTH = 0x1000    /* ROM BSS RAM: 4K */</span><br><span class="line">        MSP_RAM (wx)  :                 ORIGIN = 0x1003E000, LENGTH = 0x1000    /* MSP RAM: 4k */</span><br><span class="line">        RDP_RAM (wx)  :                 ORIGIN = 0x1003F000, LENGTH = 0xFF0     /* RDP RAM: 4k-0x10 */</span><br><span class="line"></span><br><span class="line">        XIPBOOT (rx)  :                 ORIGIN = 0x08000000+0x20, LENGTH = 0x04000-0x20 /* XIPBOOT: 32k, 32 Bytes resvd for header*/</span><br><span class="line">        XIPSYS (r) :                    ORIGIN = 0x08009000, LENGTH = 0x1000    /* XIPSYS: 4K system data in flash */</span><br><span class="line">        XIPCAL (r) :                    ORIGIN = 0x0800A000, LENGTH = 0x1000    /* XIPCAL: 4K calibration data in flash */</span><br><span class="line">        XIP1 (rx)  :                    ORIGIN = 0x08019000+0x20, LENGTH = 0xE2000-0x20 /* XIP1: 904k, 32 Bytes resvd for header */</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">PROVIDE(app_download_addr = 0xffffffff);</span><br><span class="line">PROVIDE(kernel_download_addr = 0x8100000);</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>这里是截取了一小部分，链接脚本是有自己的语法的，前面学习单片机的时候起始都了解过，这里不再详细说了，我们看最后一个XIP1这一行，看到这个19000，会发现它与makefile文件中 APP_OFFSET 偏移地址是一致的，那么前面还有个 0x08000000 是为什么？这是因为rtl8710bn 内核为ARM cortex -M4 外部挂载flash映射到CPU地址 0x8000000开始。</p>
<h1 id="三、esp8266-OTA原理"><a href="#三、esp8266-OTA原理" class="headerlink" title="三、esp8266-OTA原理"></a><font size=3>三、esp8266-OTA原理</font></h1><h2 id="1-esp8266-flash分区"><a href="#1-esp8266-flash分区" class="headerlink" title="1. esp8266 flash分区"></a><font size=3>1. esp8266 flash分区</font></h2><p>我们来看一下esp8266的flash分区情况：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20200708164623382.png" alt="image-20200708164623382" style="zoom:50%;" />

<blockquote>
<p>分区说明</p>
</blockquote>
<p>可以看到esp8266的flash一共分为两个区域，分区1和分区2，在分区1前面有一个Boot信息，这个boot信息来决定是执行分区1的user1.bin程序还是分区2的user2.bin程序。就比如说，user1.bin就是我们的app程序，user2.bin就是我们的ota程序，那么开机的时候执行哪个，就是由boot来决定。在esp8266 flash的最后部分区域，有wifi参数的、系统参数的一些分区，所以其实esp8266其实已经把flash区域的划分给定死了，这也就导致了AliOS-Things没有办法去实现像mk3080一样的一个2nd_boot，esp8266的boot就完全由芯片厂商自己决定，并且还不开源，但是芯片厂商会提供给我们，所以前面烧录esp8266的helloworld程序的话，我们使用软件烧录了两个程序，一个是boot，一个是我们的helloworld应用程序。其实这里我还是有些不理解，但是由于学习的主要是mk3080，所以这里先这样，后边有机会再补充吧。</p>
<blockquote>
<p>怎么知道是这样分区的？</p>
</blockquote>
<p>那上面的分区为什么是那样？我们怎么知道的？我们可以看一下esp8266的链接脚本。</p>
<h2 id="2-链接脚本-1"><a href="#2-链接脚本-1" class="headerlink" title="2. 链接脚本"></a><font size=3>2. 链接脚本</font></h2><p>和mk3080一样，都有两个地方有链接文件，它们其实是一样的，我们看一下工程目录下的链接文件：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">hk@vm:~/6AliOS/helloworld_esp8266/board/esp8266/ld$ tree</span><br><span class="line">.</span><br><span class="line">├── eagle.app.v6.common.ld          # 链接脚本的公共文件   </span><br><span class="line">├── eagle.app.v6.new.1024.app1.ld   # app链接脚本</span><br><span class="line">├── eagle.app.v6.new.1024.app2.ld   # app_ota 链接脚本</span><br><span class="line">├── eagle.app.v6.new_8285.1024.app1.ld</span><br><span class="line">└── eagle.rom.addr.v6.ld</span><br><span class="line"></span><br><span class="line">0 directories, 5 files</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118094737636.png" alt="image-20231118094737636" style="zoom:50%;" />

<p>我们来看一下这个 eagle.app.v6.new.1024.app1.ld文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118094913582.png" alt="image-20231118094913582" style="zoom:50%;" />

<p>在这个链接脚本开始的时候为我们画出了flash分区情况，着一股脑其实我们就可以理解为什么前面烧写的时候，文件后面的地址为什么是0x0000，为什么是0x1000了。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118095051408.png" alt="image-20231118095051408" style="zoom:50%;" />

<h1 id="四、在mk3080上体验OTA"><a href="#四、在mk3080上体验OTA" class="headerlink" title="四、在mk3080上体验OTA"></a><font size=3>四、在mk3080上体验OTA</font></h1><p>我这里只有mk3080的开发板，这里用这个开发板来体验吧。</p>
<h2 id="1-修改工程源码"><a href="#1-修改工程源码" class="headerlink" title="1. 修改工程源码"></a><font size=3>1. 修改工程源码</font></h2><p>我们先修改 工程目录下的 helloworld_mk3080&#x2F;appdemo.c文件：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdlib.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;aos/kernel.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&quot;aos/init.h&quot;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&quot;board.h&quot;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;k_api.h&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="type">int</span> <span class="title function_">application_start</span><span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="type">int</span> count = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;nano entry here!\r\n&quot;</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">//fd = board_lcd_create(&quot;name&quot;);</span></span><br><span class="line">    <span class="comment">//board_lcd_write(fd,buffer,len);</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">while</span>(<span class="number">1</span>) &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;hello ssq! count %d \r\n&quot;</span>, count++);</span><br><span class="line"></span><br><span class="line">        aos_msleep(<span class="number">2000</span>);</span><br><span class="line">    &#125;;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>然后通过下面的命令编译程序：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">aos make</span><br></pre></td></tr></table></figure>

<p>编译完成后我们会得到下面这些文件：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">hk@vm:~/6AliOS/helloworld_mk3080/out/helloworld_mk3080@mk3080/binary$ ll</span><br><span class="line">总用量 5404</span><br><span class="line">drwxrwxr-x 2 hk hk    4096 11月 18 09:55 ./</span><br><span class="line">drwxrwxr-x 8 hk hk    4096 11月 18 09:23 ../</span><br><span class="line">-rw-rw-r-- 1 hk hk    4496 11月 18 09:55 boot_all.bin</span><br><span class="line">-rw-rw-r-- 1 hk hk 1077968 11月 18 09:55 helloworld_mk3080@mk3080.bin</span><br><span class="line">-rwxrwxr-x 1 hk hk 1388828 11月 18 09:55 helloworld_mk3080@mk3080.elf*</span><br><span class="line">-rw-rw-r-- 1 hk hk  162839 11月 18 09:55 helloworld_mk3080@mk3080.hex</span><br><span class="line">-rw-rw-r-- 1 hk hk 2822462 11月 18 09:55 helloworld_mk3080@mk3080.map</span><br><span class="line">-rw-rw-r-- 1 hk hk    1700 11月 18 09:55 helloworld_mk3080@mk3080_map.csv</span><br><span class="line">-rw-rw-r-- 1 hk hk   57952 11月 18 09:55 helloworld_mk3080@mk3080_ota.bin</span><br><span class="line">-rw-rw-r-- 1 hk hk   36304 11月 18 09:55 helloworld_mk3080@mk3080_ota.bin.xz</span><br><span class="line">-rwxrwxr-x 1 hk hk  221364 11月 18 09:55 helloworld_mk3080@mk3080.stripped.elf*</span><br><span class="line">-rwxrwxr-x 1 hk hk   17640 11月 18 09:55 image2_2ndboot.bin*</span><br><span class="line">-rw-rw-r-- 1 hk hk    2078 11月 18 09:23 link.opts</span><br><span class="line">-rw-rw-r-- 1 hk hk     277 11月 18 09:55 readme.txt</span><br></pre></td></tr></table></figure>

<p>这一次我们要烧写ota程序，所以我们要用的就是这个 helloworld_mk3080@mk3080_ota.bin文件了，可以看到这个文件与helloworld_<a href="mailto:&#109;&#x6b;&#x33;&#48;&#56;&#x30;&#x40;&#x6d;&#x6b;&#51;&#48;&#56;&#x30;&#46;&#98;&#105;&#x6e;">&#109;&#x6b;&#x33;&#48;&#56;&#x30;&#x40;&#x6d;&#x6b;&#51;&#48;&#56;&#x30;&#46;&#98;&#105;&#x6e;</a>相比，小了很多，这是因为后者包含了boot，2nd_boot和app，而ota文件就只有app_ota啦。</p>
<h2 id="2-烧录工具与硬件配置"><a href="#2-烧录工具与硬件配置" class="headerlink" title="2. 烧录工具与硬件配置"></a><font size=3>2. 烧录工具与硬件配置</font></h2><p>还记得之前烧录的时候我们需要用抓专门的烧录软件，硬件上也要配置一下进入烧写模式，但是这里我们烧写的是ota程序，可以不用前面的工具，我们直接通过串口升级，也就是后边要说的ymodem模式烧写，这样我们就只需要一个串口工具啦。</p>
<h2 id="3-Ymodem协议烧写OTA程序"><a href="#3-Ymodem协议烧写OTA程序" class="headerlink" title="3. Ymodem协议烧写OTA程序"></a><font size=3>3. Ymodem协议烧写OTA程序</font></h2><p>我们先来看一下开机的时候的提示信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101103395.png" alt="image-20231118101103395" style="zoom: 60%;" />

<p>这里其实已经提醒我们了，我们按下w键就可以进入AliOS-Things的2nd_boot中，这个怎么按？就跟进电脑的bios一样，开机后迅速快按启动按键即可，只是这里我们在mk3080复位后，重新启动时要按下w，但是我们只有100ms的时间，所以我们直接长按，然后就会出现下面的打印信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101400689.png" alt="image-20231118101400689" style="zoom:50%;" />

<p>然后我我们就进入了一个命令行终端，前面会有 <code>aos boot #</code> 的提示，然后我们根据提示，按下1，也就是启动串口的Ymodem协议更新：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101551086.png" alt="image-20231118101551086" style="zoom:45%;" />

<p>然后会提示我们输入flash地址，看上面是有提示的，我们可以通过Ymodem协议将ota程序下载到os part或者OTA part，我们只需要输入后面的起始偏移地址就可以了，我们想要开机就运行新烧录的ota应用程序的话，我们就将它直接烧录到os part去，也就是输入0x19000即可：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118101855192.png" alt="image-20231118101855192" style="zoom:50%;" />

<p>然后就会一直停在这里等待我们发送ota应用程序啦，怎么发送？我们在MobaXterm中【右键】&rarr;【Send file using Z-modem】&rarr;【选择ota程序】然后确认即可。注意：不是用的Ymodem嘛，是的，但是这只是一种传输协议，我也不是很清楚我用的MobaXterm中为什么没见这个Ymodem协议，只有一个Z-modem协议，但是我实际试了一下，Z-modem也是可以的，2nd_boot也是可以正常接收和解析的，具体它们有什么区别，暂时没有细细研究。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118102348347.png" alt="image-20231118102348347" style="zoom:50%;" />

<p>传输完成后，会有以下提示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118102755088.png" alt="image-20231118102755088" style="zoom:50%;" />

<p>然后我们重启开发板，就可以看到如下打印信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20231118102855521.png" alt="image-20231118102855521" style="zoom:44%;" />

<p>当然也可以使用SecureCRT，它是有Y-modem的：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/01HQ%E8%AF%BE%E7%A8%8B%E4%BD%93%E7%B3%BB/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/LV01-01-AliOSThings-08-OTA/img/image-20200630165512276.png" alt="image-20200630165512276" style="zoom: 25%;" />


    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/eb6d74df.html">LV01-01-AliOSThings-08-OTA</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年11月26日 - 21:33</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/eb6d74df.html" title="LV01-01-AliOSThings-08-OTA">https://sumumm.github.io/post/eb6d74df.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/LV21-%E5%A4%A9%E7%8C%AB%E7%B2%BE%E7%81%B5IOT/" rel="tag"><i class="fa fa-tag"></i> LV21-天猫精灵IOT</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/a78884d1.html" rel="prev" title="LV01-01-AliOSThings-09-源码与编译-01-SDK目录分析">
                  <i class="fa fa-angle-left"></i> LV01-01-AliOSThings-09-源码与编译-01-SDK目录分析
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/d2e682ad.html" rel="next" title="LV01-01-AliOSThings-07-HelloWorld工程源码">
                  LV01-01-AliOSThings-07-HelloWorld工程源码 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
